let mongoose=require('./db');

let ArticleSchema=new mongoose.Schema({
    title:String,        //文章标题
    addTime:String,      //添加时间
    lastModified:String, //上次修改日期
    publishDate:String,  //自定义的发布时间
    cateid:String,       //所属分类
    catename:String,     //分类名称
    tags:Array,         //标签
    cover:String,       //封面
    detail:String,      //详情
    num:Number,         //浏览次数
    seo:{
        keywords:String,  //关键词
        desc:String,        //描述
        url:String        //地址
    },
    comments:Array      //评论
});
ArticleSchema.methods.pinglun=function (obj,callback) {
    this.comments.push(obj);
    this.save();
};
let Article = mongoose.model('Article', ArticleSchema);

module.exports=Article;